package net.mihome.app.bean;

import com.google.gson.internal.LinkedTreeMap;

import java.util.Map;

/**
 * 我的个人信息实体类
 * @author liux (http://my.oschina.net/liux)
 * @version 1.0
 * @created 2012-3-21
 */
public class MyInformation extends Entity{

	private String name;
	private String face;
	private String jointime;
	private int gender;
	private String from;
	private String devplatform;
	private String expertise;
	private int favoritecount;
	private int fanscount;
	private int followerscount;

	
	//米宅用户信息
	private String username;
	private String realname;
	private String mobile;
	private String openId;
	private String email;
	private String avatar;
	private double sex;
	private Community community;
	private Company company;
    private String address;

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Company getCompany() {
		return company;
	}
	public void setCompany(Company company) {
		this.company = company;
	}
	public String getJointime() {
		return jointime;
	}
	public void setJointime(String jointime) {
		this.jointime = jointime;
	}
	public int getGender() {
		return gender;
	}
	public void setGender(int gender) {
		this.gender = gender;
	}
	public String getDevplatform() {
		return devplatform;
	}
	public void setDevplatform(String devplatform) {
		this.devplatform = devplatform;
	}
	public String getExpertise() {
		return expertise;
	}
	public void setExpertise(String expertise) {
		this.expertise = expertise;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getFace() {
		return face;
	}
	public void setFace(String face) {
		this.face = face;
	}
	public String getFrom() {
		return from;
	}
	public void setFrom(String from) {
		this.from = from;
	}
	public int getFavoritecount() {
		return favoritecount;
	}
	public void setFavoritecount(int favoritecount) {
		this.favoritecount = favoritecount;
	}
	public int getFanscount() {
		return fanscount;
	}
	public void setFanscount(int fanscount) {
		this.fanscount = fanscount;
	}
	public int getFollowerscount() {
		return followerscount;
	}
	public void setFollowerscount(int followerscount) {
		this.followerscount = followerscount;
	}
	//米宅信息setter
	
	public static MyInformation parse(Map map){
		MyInformation myInformation=new MyInformation();
		myInformation.setUsername((String) map.get("username"));
		myInformation.setRealname((String) map.get("realname"));
		myInformation.setMobile((String) map.get("mobile"));
		myInformation.setEmail((String) map.get("email"));
		myInformation.setOpenId((String) map.get("open_id"));
		myInformation.setAvatar((String) map.get("avatar"));
		myInformation.setAddress((String) map.get("address"));
        myInformation.setId(((Double)map.get("id")).intValue());
        if(map.get("sex")!=null){
            myInformation.setSex((Double) map.get("sex"));
        }
		myInformation.setJointime((String) map.get("create_at"));
		LinkedTreeMap<String,String> community=(LinkedTreeMap<String, String>) map.get("community");
		if(community!=null){
			Community community2=new Community();
			community2.setName(community.get("name"));
			myInformation.setCommunity(community2);
		}
		LinkedTreeMap<String,String> company=(LinkedTreeMap<String, String>) map.get("company");
		if(company!=null){
			Company company2=new Company();
			company2.setName(company.get("name"));
			company2.setFullName(company.get("fullname"));
			myInformation.setCompany(company2);
		}
		return myInformation;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getRealname() {
		return realname;
	}
	public void setRealname(String realname) {
		this.realname = realname;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getAvatar() {
		return avatar;
	}
	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}
	public double getSex() {
		return sex;
	}
	public void setSex(double sex) {
		this.sex = sex;
	}
	public Community getCommunity() {
		return community;
	}
	public void setCommunity(Community community) {
		this.community = community;
	}

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }
}
